FROM {{ cassandraDockerImage }}

RUN useradd -m cassandra_user

# script to orchestrate the automatic keyspace creation and apply all migration scripts
COPY cassandra/scripts/autoMigrate.sh /usr/local/bin/autoMigrate
RUN chmod 755 /usr/local/bin/autoMigrate

# script to run any cql script from src/main/resources/config/cql
COPY cassandra/scripts/execute-cql.sh /usr/local/bin/execute-cql
RUN chmod 755 /usr/local/bin/execute-cql

USER cassandra_user

ENTRYPOINT ["autoMigrate"]
